package com.soft.one.db;

import com.soft.one.entity.Menu;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

public class MenuDb {


    //菜单列表
    private static List<Menu> menuList = new ArrayList<>();

    static {
        menuList.add(new Menu(1,"夫妻肺片",28.56));
        menuList.add(new Menu(2,"宫保鸡丁",32.0));
        menuList.add(new Menu(3,"麻婆豆腐",25.0));
        menuList.add(new Menu(4,"回锅肉",30));
        menuList.add(new Menu(5,"红烧大虾",40.0));
        menuList.add(new Menu(6,"四喜丸子",28.0));
        menuList.add(new Menu(7,"烤乳猪",12.56));
        menuList.add(new Menu(8,"佛跳墙",12.56));
        menuList.add(new Menu(9,"兰州牛肉面",12.56));
        menuList.add(new Menu(10,"西湖牛肉羹",12.56));

    }

    public static List<Menu> getMenuList() {
        return menuList;
    }

    public static Map<String, Menu> getMenuMap() {

        Map<String, Menu> menuMap = new HashMap<>();

        for (Menu menu : menuList) {
            menuMap.put(menu.getId()+"", menu);
        }
        return menuMap;
    }

    public static void setMenuList(List<Menu> menuList) {
        MenuDb.menuList = menuList;
    }
}
